package com.tping.sp.config;

import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * 添加扫描注解
 */
@Configuration
@ComponentScan("com.tping.sp")
@EnableWebMvc
public class ApplicationConfig implements WebMvcConfigurer {


    /**
     * 添加解析JSON转换器
     *
     * @param converters
     */
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {

        FastJsonHttpMessageConverter fastJson = new FastJsonHttpMessageConverter();
        converters.add(fastJson);

    }
}
